/**
 * 
 */
package com.dsbridge.enrollment.business;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.dsbridge.enrollment.entities.CourseAuthor;
import com.dsbridge.enrollment.entities.Subject;
import com.dsbridge.enrollment.jpadao.CourseAuthorJPADAO;
import com.dsbridge.enrollment.jpadao.SubjectsJPADAO;
import com.dsbridge.enrollment.model.CoursesDTO;

/**
 * @author rithvik
 *
 */
@Service("courseBusinessService")
public class CourseBusinessServiceImpl implements CourseBusinessService {

	@Autowired
	private SubjectsJPADAO subjectsJPADAO;
	
	@Autowired
	private CourseAuthorJPADAO courseAuthorJPADAO;
	/* (non-Javadoc)
	 * @see com.dsbridge.enrollment.business.CourseBusinessService#createCourse(java.lang.String, java.lang.String, int, int)
	 */
	@Override
	public int createCourse(CoursesDTO coursesDTO) {
		
		return 0;
	}

	@Override
	@Transactional
	public int createSubject(Subject subject) {
		return subjectsJPADAO.createSubject(subject);
	}

	@Override
	@Transactional
	public int createAuthor(CourseAuthor courseAuthor) {
		// TODO Auto-generated method stub
		return courseAuthorJPADAO.createAuthor(courseAuthor);
	}

	@Override
	public List<CourseAuthor> getAuthors() {
		
		return courseAuthorJPADAO.retrieveAllAuthors();
	}

	@Override
	public List<Subject> getSubjects() {
		
		return subjectsJPADAO.retrieveAllAuthors();
	}

}
